/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.worsik.vypocty.topeni.tepelneztraty.dao.mapper;

import cz.worsik.vypocty.topeni.tepelneztraty.model.SvetovaStrana;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;

/**
 *
 * @author 231260
 */
public final class SvetovaStranaMapper implements RowMapper<SvetovaStrana> {

	public SvetovaStrana mapRow(ResultSet rs, int rowNum) throws SQLException {
		
		SvetovaStrana strana = new SvetovaStrana();
		
		strana.setId(rs.getLong("id"));
		strana.setNazev(rs.getString("nazev"));
		strana.setPopis(rs.getString("popis"));
		
		if (rs.getObject("p2") != null)
			strana.setP2(rs.getDouble("p2"));
		else
			strana.setP2(0);
		
		return strana;
	}
	
}
